<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Loadimage extends CI_Controller {
	public $data;

	function __construct(){
		parent::__construct();
	}

	function index(){
		$this->load->model('Info_model');
		$data = $this->Info_model->getImage($this->session->userdata('User_id'));
		if($data && $data[0]->image){
			$this->data['data'] = $data[0]->image;
		}else{
			$tmpName = dirname(__FILE__).'/../../common/images/images.jpg';
			$fp = fopen($tmpName, 'r');
			$this->data['data']  = fread($fp, filesize($tmpName));
			fclose($fp);
		}

		$this->load->view('loadimage/index', $this->data);
	}
}